home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / ada / c01lab5.zip / CRUISE / CODE / MAIN.ADA < prev   
Text File  |  1992-03-17  |  2KB  |  68 lines

  1. with Cruise; use Cruise;
  2. with Automobile_Interface; use Automobile_Interface;
  3. with Console; use Console;
  4. -- **************************************************************
  5. -- *                                                            *
  6. -- *  Main                                                      *  SPEC
  7. -- *                                                            *
  8. -- **************************************************************
  9. procedure Main is
  10. --|  Purpose
  11. --|  Executable procedure which uses package Cruise in order
  12. --|  to implement an automobile cruise control program.
  13. --|
  14. --|  Procedure Main uses two tasks, Control and Fetch.  
  15. --|    
  16. --|  Task Control initializes the terminal, prints the menu, determines
  17. --|  whether the user or the cruise control is regulating 
  18. --|  automobile speed, and continually updates the dashboard.
  19. --|
  20. --|  Task Fetch retrieves the user command and updates the
  21. --|  appropriate global variables to update current program
  22. --|  status.
  23.  
  24. --...............................................................
  25. --.                                                                .
  26. --.  Task : Fetch                                                .
  27. --.                                                                .
  28. --...............................................................
  29. task Fetch;                -- task specification
  30. task body Fetch is         -- task body
  31. begin
  32.     while (not quit) loop
  33.         quit := Fetch_Key;
  34.     end loop;
  35. end Fetch;                -- end task body
  36.  
  37. --...............................................................
  38. --.                                                                .
  39. --.  Task : Control                                                .
  40. --.                                                                .
  41. --...............................................................
  42. task Control;            -- task specification
  43. task body Control is     -- task body
  44. begin
  45.     Set_Terminal(VT100);
  46.     Erase_Display;
  47.     Print_Menu;
  48.     while (not quit) loop
  49.         if key /= 'l' then
  50.             Determine_Control;
  51.         end if;
  52.         Update_Dashboard;
  53.         Update;
  54.         delay 0.3;
  55.     end loop;
  56. end Control;            -- end task body
  57.  
  58. -- **************************************************************
  59. -- *                                                            *
  60. -- *  Main                                                      *  BODY
  61. -- *                                                            *
  62. -- **************************************************************
  63. --|  Tasks Control and Fetch begin execution upon call of Main.
  64.  
  65. begin
  66.     null;
  67. end Main;
  68.